package cloudInformation.service.impl;

import cloudEntity.entity.SmartClubEntity;
import cloudEntity.leftJoin.ClubPersonLeftJoin;
import cloudEntity.vo.PageBeanVO;
import cloudInformation.mapper.SmartClubMapper;
import cloudInformation.service.SmartClubService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: Smart School
 * @ClassName SmartClubServiceImpl
 * @description:
 * @author: 陈智博
 * @create: 2025-04-14 08:31
 * @Version 1.0
 **/
@Service
public class SmartClubServiceImpl implements SmartClubService {

    @Autowired
    private SmartClubMapper smartClubMapper;

    @Override
    public PageBeanVO<SmartClubEntity> GetClubByPage(String clubName, Integer pageNum, Integer pageSize) {
        Integer pageBean = (pageNum - 1) * pageSize;
        Integer i = smartClubMapper.GetClubCount(clubName);
        List<SmartClubEntity> byPage = smartClubMapper.getByPage(clubName, pageBean, pageSize);
        return new PageBeanVO<>(pageNum,pageSize,i,byPage);
    }

    @Override
    public PageBeanVO<ClubPersonLeftJoin> GetClubByIds(String clubIds, Integer pageNum, Integer pageSize) {
        Integer pageBean = (pageNum - 1) * pageSize;
        Integer clubPerson =  smartClubMapper.GetClubPersonCount(clubIds);
        List<ClubPersonLeftJoin> clubPersonByPageWhereIds = smartClubMapper.getClubPersonByPageWhereIds(clubIds, pageBean, pageSize);
        return new PageBeanVO<>(pageNum,pageSize,clubPerson,clubPersonByPageWhereIds);
    }


}
